const {
	app,
	conn
} = require('./serive')

app.post('/news/releaseNew', (req, res) => {
	const imgUrl = res.body.imgUrl;
	const content = res.body.content;
	const title = res.body.title;
	const author = res.body.author;
	const sqlStr =
		`insert into news (imgUrl,content,title,author) values (${imgUrl},${content},${title},${author})`
	jwt.verify(token, 'ces', function(err, decode) {
		if (err) { //  时间失效的时候或者伪造的token          
			res.send({
				code: 0,
				message: 'token过期'
			});
		} else {
			conn.query(sqlStr, (err, results) => {
				if (err) return res.json({
					code: 0,
					message: '发布失败',
				})
				res.json({
					code: 1,
					message: '发布成功',
				})
			})
		}
	})

})
